package com.darren.archive.service;

import com.darren.archive.entity.SysUser;
import com.darren.framework.service.GenericService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;


/**
 * <pre>
 * *********************************************
 * Copyright DARREN
 * All rights reserved.
 * Description: TODO(description)
 * HISTORY:
 * *********************************************
 *  Version		Date		Author	   		Desc
 *   v1.0       2018-04-11  Darren Zhou    Create
 *
 * *********************************************
 * </pre>
 */
public interface SysUserService extends GenericService<SysUser, Long> {

    SysUser findByUserAccountOrMobile(String queryString);

    List<SysUser> findByNameLike(String name);

    Page<SysUser> findByNameLike(String name, Pageable pageable);

    Page<SysUser> findAll(Pageable pageable);

    SysUser saveEnable(SysUser record);

    /**
     * 修改用户密码
     *
     * @param id          用户id
     * @param oldPassword 旧密码
     * @param password    新密码
     * @return
     */
    Integer updatePassword(Long id, String oldPassword, String password);

    /**
     * 根据用户 id 重置用户密码
     *
     * @param id 用户id
     * @return
     */
    Integer resetPassword(Long id);

}
